<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>
			系统设置
		</title>
		<meta name="renderer" content="webkit" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="format-detection" content="telephone=no" />
		<link rel="stylesheet" href="css/main.css" media="all" />
		<script type="text/javascript" src="lib/loading/okLoading.js"></script>
	</head>
	<body>
		<div class="x-nav">
			<span class="layui-breadcrumb"> <a><cite>首页</cite></a> <a><cite>系统管理</cite></a> <a><cite>系统设置</cite></a>
			</span>
			<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
				href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon"
					style="line-height:30px">ဂ</i></a>
		</div>
		<div class="x-body">
			<form class="layui-form layui-form-pane" action="">
				<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
					<ul class="layui-tab-title">
						<li class="layui-this">网站设置</li>
						<li>安全设置</li>
						<li>关闭网站</li>
					</ul>
					<div class="layui-tab-content">
						<div class="layui-tab-item layui-show">
							<input type="hidden" name="id" value="1" />
							<div class="layui-form-item">
								<label class="layui-form-label"> <span class="x-red">*</span>网站名称 </label>
								<div class="layui-input-block">
									<input id="wangzhanmingcheng" type="text" name="name" autocomplete="off"
										placeholder="控制在25个字、50个字节以内" class="layui-input" value="" />
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label"> <span class="x-red">*</span>关键词 </label>
								<div class="layui-input-block">
									<input id="keyWord" type="text" name="keywords" autocomplete="off"
										placeholder="5个左右,8汉字以内,用英文,隔开" class="layui-input" value="" />
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label"> <span class="x-red">*</span>描述 </label>
								<div class="layui-input-block">
									<input id="description" type="text" name="desc" autocomplete="off"
										placeholder="空制在80个汉字，160个字符以内" class="layui-input" value="" />
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label"> <span class="x-red">*</span>网站LOGO </label>
								<div class="layui-input-block">
									<div class="site-demo-upbar">
										<div class=" layui-upload-button" style="border:#FFFFFF ;">
											<button type="button" class="layui-btn" id="test1"> <i
													class="layui-icon"></i>上传图片 </button>
											<input class="layui-upload" type="file" accept="undefined" id="previewImg"
												name="img" onchange="upload(this,1)" />
										</div>
									</div>
								</div>
							</div>
							<div class="layui-form-item imgs" id="imgshow">
								<label class="layui-form-label">LOGO展示 </label>
								<img src="./images/tx.jpg" id="pimages" name="pimages"
									style="width: 100px;height: 100px;" />
								<input id="avatar" name="images" required="" type="hidden" value="./images/tx.jpg" />
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label"> <span class="x-red">*</span>底部版权信息 </label>
								<div class="layui-input-block">
									<input type="text" name="copyright" autocomplete="off"
										placeholder="&copy; 2016 main" class="layui-input" value="" />
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label"> <span class="x-red">*</span>备案号 </label>
								<div class="layui-input-block">
									<input id="beianhao" type="text" name="record" autocomplete="off"
										placeholder="XICP备00000000号" class="layui-input" value="" />
								</div>
							</div>
							<div class="layui-form-item layui-form-text">
								<label class="layui-form-label"> <span class="x-red">*</span>统计代码 </label>
								<div class="layui-input-block">
									<textarea id="tongjidaima" placeholder="请输入内容" class="layui-textarea"
										name="statistics">           11000</textarea>
								</div>
							</div>
							<div class="layui-form-item">
								<button class="layui-btn" lay-submit="" lay-filter="*"> 保存 </button>
							</div>
							<div style="height:100px;"></div>
						</div>
						<div class="layui-tab-item">
							<div class="layui-form-item layui-form-text">
								<label class="layui-form-label"> <span class="x-red">*</span>允许访问后台的IP列表 </label>
								<div class="layui-input-block">
									<textarea placeholder="请输入内容" class="layui-textarea"
										name="allow_ip">        127.0.0.1</textarea>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label"> <span class="x-red">*</span>最大次数 </label>
								<div class="layui-input-inline">
									<input type="number" name="max_count" lay-verify="number" autocomplete="off"
										class="layui-input" min="0" value="5" />
								</div>
							</div>
							<div class="layui-form-item">
								<button class="layui-btn" lay-submit="" lay-filter="*"> 保存 </button>
							</div>
						</div>
						<div class="layui-tab-item">
							<div class="layui-form-item">
								<label for="AppId" class="layui-form-label"> <span class="x-red">*</span>是否开启 </label>
								<div class="layui-input-block">
									<input type="checkbox" name="status" {if="" $set.status="=" 1}="" checked="checked"
										{="" f}="" lay-skin="switch" lay-filter="switchTest" title="开关"
										lay-text="ON|OFF" />
								</div>
							</div>
							<div class="layui-form-item">
								<label for="L_repass" class="layui-form-label"> </label>
								<button class="layui-btn" lay-filter="*" lay-submit=""> 保存 </button>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
		<script src="lib/layui/layui.js" charset="utf-8"></script>
		<script src="js/x-layui.js" charset="utf-8"></script>
		<script>
			layui.use(['element', 'layer', 'form'], function() {
				$ = layui.jquery; //jquery
				lement = layui.element(); //面包导航
				layer = layui.layer; //弹出层
				form = layui.form();
				okLoading.close($);


				//监听提交
				form.on('submit(*)', function(data) {
					var data = data.field;
					$.ajax({
						type: "post",
						url: "xxx",
						data: data,
						success: function(data) {
							if (data.status == 1) {
								layer.msg(data.info, {
									icon: 1,
									time: 1000
								});
								setTimeout(function() {
									window.parent.location.reload();
									var index = parent.layer.getFrameIndex(window.name);
									parent.layer.close(index);
								}, 1000);
								return false;
							} else {
								layer.msg(data.info, {
									icon: 5,
									time: 2000
								});
								return false;
							}
						}
					});
					return false;
				});

			})
		</script>
		<script>
			//LOGO上传
			function upload(obj, id) {
				var formData = new FormData();
				formData.append('img', $('#previewImg')[0].files[0]);
				formData.append('id', id); //将id追加再id中
				layer.msg('图片上传中', {
					icon: 16
				});
				$.ajax({
					type: "post",
					processData: false,
					contentType: false,
					url: "xxx",
					data: formData,
					success: function(data) {
						if (data.status == 1) {
							//console.log(data.image_name);
							layer.closeAll('loading');
							//layer.msg(data.info,{icon:1,time:1000});
							$("#pimages").attr('src', data.image_name);
							$("#avatar").val(data.image_name);
							$(".imgs").show();
							return false;
						} else {
							layer.msg(data.info, {
								icon: 2,
								time: 1000
							});
						}
					}
				});
			}
		</script>
	</body>
</html>